<html>
<head><meta charset="utf-8"><title>mir_borrowck cache on disc · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html">mir_borrowck cache on disc</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202832400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832400">(Jul 03 2020 at 19:42)</a>:</h4>
<p><code>query mir_borrowck</code> is currently only cached on disk if <br>
<code>tcx.is_closure(key.to_def_id()) || opt_result.map_or(false, |r| !r.concrete_opaque_types.is_empty())</code></p>
<p>Why are ordinary functions not cached?</p>



<a name="202832408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832408">(Jul 03 2020 at 19:42)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/f844ea1e561475e6023282ef167e76bc973773ef/src/librustc_middle/query/mod.rs#L577-L578">https://github.com/rust-lang/rust/blob/f844ea1e561475e6023282ef167e76bc973773ef/src/librustc_middle/query/mod.rs#L577-L578</a></p>



<a name="202832438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832438">(Jul 03 2020 at 19:43)</a>:</h4>
<p>Ordinary functions don't have upvars, so the <code>mir_borrowck</code> result is never directly used. It is mainly for the error side-effects.</p>



<a name="202832465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832465">(Jul 03 2020 at 19:43)</a>:</h4>
<p><code>mir_borrowck</code> returns <a href="https://github.com/rust-lang/rust/blob/8a6d4342be6a6acbade8e7ef65e73d27ee8c9144/src/librustc_middle/mir/query.rs#L139-L146">https://github.com/rust-lang/rust/blob/8a6d4342be6a6acbade8e7ef65e73d27ee8c9144/src/librustc_middle/mir/query.rs#L139-L146</a></p>



<a name="202832577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832577">(Jul 03 2020 at 19:45)</a>:</h4>
<p>So if a query is not cached on disk and is only used with <code>tcx.ensure</code>, the result does not have to be available at all</p>



<a name="202832582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202832582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202832582">(Jul 03 2020 at 19:45)</a>:</h4>
<p>as long as the dep graph is green?</p>



<a name="202833068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202833068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202833068">(Jul 03 2020 at 19:53)</a>:</h4>
<p>I think so, but I am not completely sure</p>



<a name="202833118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202833118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202833118">(Jul 03 2020 at 19:54)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/dba944a6b79caf0056ddd282de01de70a0ff8a36/src/librustc_query_system/query/plumbing.rs#L651-L685">https://github.com/rust-lang/rust/blob/dba944a6b79caf0056ddd282de01de70a0ff8a36/src/librustc_query_system/query/plumbing.rs#L651-L685</a><br>
<a href="https://github.com/rust-lang/rust/blob/1033351a51dd3ca342a83d4be13f7554f0b4fb1e/src/librustc_query_system/dep_graph/graph.rs#L499-L536">https://github.com/rust-lang/rust/blob/1033351a51dd3ca342a83d4be13f7554f0b4fb1e/src/librustc_query_system/dep_graph/graph.rs#L499-L536</a></p>



<a name="202884045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/mir_borrowck%20cache%20on%20disc/near/202884045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/mir_borrowck.20cache.20on.20disc.html#202884045">(Jul 04 2020 at 17:42)</a>:</h4>
<p>ohhh I haven't considered that - that's a good explanation if why we need <code>ensure</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>